package felix.rule.data.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.JsonNode;
import felix.rule.data.msg.RuleChain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

@EqualsAndHashCode(callSuper = true)
@TableName("rule_chain")
@Data
@NoArgsConstructor
public class RuleChainEntity extends BaseEntity<RuleChain> {
    /**
     * 规则id
     */
    private String ruleId;
    /**
     * 规则名
     */
    private String name;
    /**
     * 附加信息
     */
    private JsonNode additionalInfo;
    /**
     * 配置信息
     */
    private JsonNode configuration;
    /**
     * 首个节点信息
     */
    private String firstRuleNodeId;
    /**
     * debug模式
     */
    private boolean debugMode;

    public RuleChainEntity(RuleChain ruleChain) {
        BeanUtils.copyProperties(ruleChain, this);
    }

    @Override
    public RuleChain toData() {
        RuleChain ruleChain = new RuleChain();
        BeanUtils.copyProperties(this, ruleChain);
        return ruleChain;
    }
}
